package com.example.image.demos.util;

import lombok.Builder;
import lombok.Data;

@Builder
@Data
public final class Result<T> {
    private int code;
    private String messsage;
    private T data;

    public static <T> Result ok(int code,String messsage,T data) {
        return builder().code(code).messsage(messsage).data(data).build();
    }
    public static <T> Result ok(T data, String message) {
        return ok(200,message,data);
    }
    public static <T> Result <T>ok(T data) {
        return ok(200,"success",data);
    }
    public static <T> Result ok() {
        return ok(200,"success",null);
    }
    public static <T> Result fail(int code,String messsage,T data) {
        return builder().code(code).messsage(messsage).data(data).build();
    }

}